<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改维修店档案')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-repairStore-edit" th:object="${zsyhUserRepairstore}">
        <h4 class="form-header h4">网点档案信息</h4>
        <input name="id" th:field="*{id}" type="hidden">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">店铺门头：</label>
                    <div class="col-sm-8">
                        <p class="user-info-head"><img id="storeImage" class="img-thumbnail img-lg" th:src="*{storeImage}"></p>
                        <!--<input type="hidden" name="storeImage" th:field="*{storeImage}">
                        <div class="file-loading">
                            <input class="form-control file-upload" id="storeImage" name="file" type="file">
                        </div>-->
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">营业执照：</label>
                    <div class="col-sm-8">
                        <p class="user-info-head"><img id="storeLicense" class="img-thumbnail img-lg" th:src="*{storeLicense}"></p>
                        <!--<input type="hidden" name="storeLicense" th:field="*{storeLicense}">
                        <div class="file-loading">
                            <input class="form-control file-upload" id="storeLicense" name="file" type="file">
                        </div>-->
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">网点联系人：</label>
                    <div class="col-sm-8" style="vertical-align: center">
                        <p name="storePerson" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storePerson}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">网点手机号：</label>
                    <div class="col-sm-8">
                        <p name="storePhone" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storePhone}]]</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">店铺名称：</label>
                    <div class="col-sm-8">
                        <p name="storeName" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeName}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">服务承诺：</label>
                    <div class="col-sm-8">
                        <p name="storeService" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeService}]]</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">店铺浏览量：</label>
                    <div class="col-sm-8">
                        <p name="storePageviews" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storePageviews}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">营业时间：</label>
                    <div class="col-sm-8">
                        <p name="storeBusinessHours" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeBusinessHours}]]</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">详细地址：</label>
                    <div class="col-sm-8">
                        <p name="storeDetailAddress" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeDetailAddress}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">开业年限：</label>
                    <div class="col-sm-8">
                        <p name="storeOpenYears" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeOpenYears}]]</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">主营产品：</label>
                    <div class="col-sm-8">
                        <p name="storeContent" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeContent}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">状态：</label>
                    <div class="col-sm-8">
                        <p name="storeStateName" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeStateName}]]</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所属大区：</label>
                    <div class="col-sm-8">
                        <p name="agentName" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{agentName}]]</p>
                    </div>
                </div>
            </div>
            <!--<div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">是否订单管理权：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('zsyh_yesno')}">
                            <input type="radio" th:id="${'isRaker_' + dict.dictCode}" name="isRaker" th:value="${dict.dictValue}" th:field="*{isRaker}" required>
                            <label th:for="${'isRaker_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>-->
        </div>
        <div class="row" id="rejectReason">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">驳回原因：</label>
                    <div class="col-sm-8">
                        <p name="storeRejectReason" style="border-width: 0px;padding:6px 4px;"  class="form-control">[[*{storeRejectReason}]]</p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
            </div>
        </div>
        <!--<div class="row">
            <div class="form-group">
                <label class="col-xs-2 control-label">身份证图片：</label>
                <div class="col-xs-10">
                    <input type="hidden" name="storeIdcardImg" th:field="*{storeIdcardImg}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="storeIdcardImg" name="file" type="file" style="border: 0px">
                    </div>
                </div>
            </div>
        </div>-->
        <div id="repairArea">
            <h4 class="form-header h4">网点管辖区域信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped" style="margin-top: 0px;">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "zsyh/repairStore";
    $("#form-repairStore-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-repairStore-edit').serialize());
        }
    }

    $(".file-upload").each(function (i) {
        debugger;
        var val = $("input[name='" + this.id + "']").val();
        var imageArr = val.split("|");
        $(this).fileinput({
            'uploadUrl': ctx + 'common/upload',
            initialPreviewAsData: true,
            initialPreview: imageArr,
            maxFileCount: 1,
            showRemove: false,/*是否显示移除按钮*/
            showUpload: false,/*是否显示上传按钮*/
            showBrowse: false,/*是否显示浏览按钮,选择按钮*/
            showCaption: false, /*是否显示被选文件的简介*/
            showClose: false,
            autoReplace: true,
            layoutTemplates: {
                actionDelete:'',
                actionUpload:''
            } /*去掉缩略图上的删除和上传按钮*/
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
        $(this).fileinput('_initFileActions');

    });

    $(function() {
        var options = {
            data: [[${zsyhUserRepairstore.zsyhUserRepairareaList}]],
            pagination: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            sidePagination: "client",
            columns: [
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                        return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'repairProvinceName',
                    align: 'center',
                    title: '省级名称',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' style='border-width: 0;text-align: center' type='text' name='zsyhUserRepairareaList[%s].repairProvinceName' value='%s' readonly>", index, value);
                        return html;
                    }
                },
                {
                    field: 'repairCityName',
                    align: 'center',
                    title: '城市名称',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' style='border-width: 0;text-align: center' type='text' name='zsyhUserRepairareaList[%s].repairCityName' value='%s' readonly>", index, value);
                        return html;
                    }
                },
                {
                    field: 'repairDistrictName',
                    align: 'center',
                    title: '县区名称',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' style='border-width: 0;text-align: center' type='text' name='zsyhUserRepairareaList[%s].repairDistrictName' value='%s' readonly>", index, value);
                        return html;
                    }
                }]
        };
        $.table.init(options);
    });

    $(document).ready(function () {
        if([[${zsyhUserRepairstore.storeStateName}]] == '驳回'){
            $("#rejectReason").css("display","block");

        }else{
            $("#rejectReason").css("display","none");
        }
        if([[${zsyhUserRepairstore.storeClassify}]] == '1'){
            $("#repairArea").css("display","block");

        }else{
            $("#repairArea").css("display","none");
        }
    })

</script>
</body>
</html>